<?php

function catch_that_image() {
  global $post, $posts;
  $first_img = '';
  ob_start();
  ob_end_clean();
  $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
  $first_img = $matches [1] [0];

  if(empty($first_img)){ //Defines a default image
    $first_img = "/images/default.jpg";
  }
  return $first_img;
}




function search_filter($query) {
    if ($query->is_search) {
        $query->set('post__not_in', array(5,17,2,61));
    }
    return $query;
}

add_filter('pre_get_posts','search_filter');


if ( function_exists('register_sidebar') ){

register_sidebar(array(

'name' => 'mainsidebar',

'before_title' => '<div id="head"><h4>',

'after_title' => '</h4></div>',

));

}


?>